package com.chengqj.dynamic.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @program: proxy
 * @description: jdk方式的动态代理类
 * @author: chengqj
 * @create: 2018-07-27 10:18
 **/
public class DynamicProxy implements InvocationHandler {
    private Object target;

    public DynamicProxy(Object obj) {
        this.target = obj;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("前期物色");
        Object proxyObj = method.invoke(target, args);
        System.out.println("后续跟踪");
        return proxyObj;
    }
}
